package com.jing.product.controller;

import com.jing.common.core.domain.R;
import com.jing.product.domain.PmsBrand;
import com.jing.product.service.BrandService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.validation.Valid;

@RestController
@RequestMapping("/product")
@Api(tags = "品牌测试表")
public class BrandController {

    @Autowired
    private BrandService brandService;

    @PostMapping("/findBrand")
    @ApiOperation(value = "测试品牌")
    public R findBrand(@RequestBody(required = false) PmsBrand pmsBrand){
        return brandService.findBrand(pmsBrand);
    }


    @PostMapping("/BrandAdd")
    @ApiOperation("添加品牌")
    public R BrandAdd(@Valid @RequestBody PmsBrand pmsBrand){
        return brandService.BrandAdd(pmsBrand);
    }

    @PostMapping("/BrandDelect")
    @ApiOperation("删除品牌")
    public String BrandDelect(@Valid @RequestBody String id){
        brandService.BrandDelect(id);
        return "删除";
    }


    @PostMapping("/BrandUpdate")
    @ApiOperation("修改品牌")
    public String BrandUpdate(@Valid @RequestBody String id){
//        brandService.BrandDelect(id);
        return "修改";
    }

}
